#include<stdio.h>
int main(){
	int N,n,a,b;
	scanf("%d",&N);
	while(N--){
		scanf("%d",&n);
		a=b=0;
		a = n/5;
		while(a>=1){
			b+=a;
			a/=5;
		}
		printf("%d\n",b);
	}
	return 0;
}